//
//  SearchViewController.m
//  StandardizedProduct
//
//  Created by 宁宁 on 16/6/27.
//  Copyright © 2016年 ym. All rights reserved.
//

#import "SearchViewController.h"

#import "SearchHeaderView.h"//搜索View

@interface SearchViewController () <UITextFieldDelegate>

@property (weak, nonatomic) IBOutlet UIView *searchView;
@property (weak, nonatomic) IBOutlet UITextField *searchTextField;//搜索框

@end

@implementation SearchViewController

- (void)viewWillDisappear:(BOOL)animated{
    self.navigationController.navigationBar.hidden = NO;
}
- (void)viewWillAppear:(BOOL)animated{
    self.navigationController.navigationBar.hidden = YES;
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self.searchTextField resignFirstResponder];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    _searchTextField.delegate = self;
    
    self.searchView.backgroundColor = [UIColor colorWithRed:255 green:255 blue:255 alpha:0.5];
    
    UIColor *color = [UIColor whiteColor];
    self.searchTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"输入关键字搜索" attributes:@{NSForegroundColorAttributeName: color}];
    
    //设置键盘
//    [self setKeyBoard];
    
}
//搜索范围
- (IBAction)searchZone:(id)sender {
    NSLog(@"宝贝");
}
- (IBAction)cancel:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField{
    //网络请求
    [self network];
    return YES;
}

//网络请求
- (void)network{
    
    
    
}

//键盘通知
//- (void)setKeyBoard{
//    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(keyBoardWillChangeFrame:) name:UIKeyboardWillChangeFrameNotification object:nil];
//}
//- (void)keyboardWillChangeFrame:(NSNotification *)notification
//{
//    // 键盘显示\隐藏完毕的frame
//    CGRect frame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
//    // 修改底部约束
//    self.bottomSapce.constant = HEIGHT - frame.origin.y;
//    // 动画时间
//    CGFloat duration = [notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue];
//    // 动画
//    [UIView animateWithDuration:duration animations:^{
//        [self.view layoutIfNeeded];
//    }];
//}
@end
